package com.dream.wuliu.utils;

import android.graphics.Bitmap;
import android.view.View;
import android.widget.ProgressBar;

import com.nostra13.universalimageloader.core.assist.FailReason;
import com.nostra13.universalimageloader.core.assist.SimpleImageLoadingListener;

public class MySimpleImageLoadingListener extends SimpleImageLoadingListener {
	
	private ProgressBar progressBar;
	
	public MySimpleImageLoadingListener(ProgressBar progressBar){
		this.progressBar = progressBar;
	}
	@Override
	public void onLoadingStarted(String imageUri, View view) {
		progressBar.setProgress(0);
		progressBar.setVisibility(View.VISIBLE);
	}

	@Override
	public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
		progressBar.setVisibility(View.GONE);
	}

	@Override
	public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
		progressBar.setProgress(100);
		progressBar.setVisibility(View.GONE);
	}
	@Override
	public void onLoadingCancelled(String imageUri, View view) {
		progressBar.setVisibility(View.GONE);
	}
	
	
	
}
